/**
 * ...
 * >author		João Vítor de Souza
 */

package com.cupcakeengine.display 
{

	import com.cupcakeengine.CKEngine;
	import com.cupcakeengine.events.EventBroadcaster;
	import com.cupcakeengine.events.ScreenEvent;
	import com.greensock.TweenMax;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;

	public class AbstractScreen extends AbstractView
	{
		// ___________________________________________________________________ CONSTANTS
		
		// ___________________________________________________________________ CLASS PROPERTIES
		
		private var _id						: String;
		
		// ___________________________________________________________________ INSTANCE PROPERTIES
		
		// ___________________________________________________________________ GETTERS AND SETTERS
		
		public function get id():String { return _id; }
		
		// ___________________________________________________________________ CONSTRUCTOR
		
		public function AbstractScreen (id:String) 
		{
			_id = id;			
		}		
		
		// ___________________________________________________________________ PUBLIC METHODS		
		
		override public function destroy():void 
		{
			super.destroy();
			
			_id = "";
		}
		
		protected function transitionOutComplete():void
		{
			TweenMax.delayedCall(1 / CKEngine.root.stage.frameRate, EventBroadcaster.broadcastEvent, [new ScreenEvent(ScreenEvent.TRANSITION_OUT_COMPLETE, _id)]);
		}
		
		protected function transitionInComplete():void
		{
			TweenMax.delayedCall(1 / CKEngine.root.stage.frameRate, EventBroadcaster.broadcastEvent, [new ScreenEvent(ScreenEvent.TRANSITION_IN_COMPLETE, _id)]);			
		}
		
		// ___________________________________________________________________ PRIVATE METHODS
		
		// ___________________________________________________________________ EVENTS
	}
}

